#!/bin/sh
# - test_cpulist
# - pgrp1_pattern
# - pgrp1_cpulist
# - pgrp2_pattern
# - pgrp2_cpulist

. $LKP_SRC/lib/reproduce-log.sh

if [ -n "$test_cpulist" ]; then
	cat >> "$TMP"/env.yaml <<EOF

# setup/taskset
exec_prefix: taskset -c $test_cpulist $exec_prefix
EOF
fi

taskset_for_pattern()
{
	pat=$1
	cpulist=$2

	if [ -n "$pat" ] && [ -n "$cpulist" ]; then
		log_eval "
for pid in \$(pgrep '$pat'); do
	taskset -pc '$cpulist' \$pid
done
"
	fi
}

taskset_for_pattern "$pgrp1_pattern" "$pgrp1_cpulist"
taskset_for_pattern "$pgrp2_pattern" "$pgrp2_cpulist"

true
